package com.service.impl;

import com.mapper.StrangecarMapper;
import com.pojo.Strangecar;
import com.service.StrangecarService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Service("strangeCarService")
public class StrangecarServiceImpl implements StrangecarService {
    @Resource
    private StrangecarMapper strangecarMapper;
    @Override
    public int addStrangeCar(Strangecar strangecar) {
        LocalDateTime localDateTime = LocalDateTime.now();
        String createtime = localDateTime.toString();
        strangecar.setStarttime(createtime);
        int i = strangecarMapper.addStrangeCar(strangecar);
        return i;
    }

    @Override
    public List<Strangecar> selectAllStrangeCar() {
        List<Strangecar> strangecars = strangecarMapper.selectAllStrangeCar();
        return strangecars;
    }

    @Override
    public int deleteStrangeCarById(Integer id) {
        int i = strangecarMapper.deleteStrangeCarById(id);
        return i;
    }
}
